using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OracleClient;

using DQS.EL;

namespace DQS.DAL
{
    public static class DQ_FB_NameService
    {
        public static IList<DQ_FB_Name> GetAllFbName()
        {
            IList<DQ_FB_Name> _objs = new List<DQ_FB_Name>();
            string sqlStr = "SELECT DISTINCT FenBu,Area_Level FROM DQ_FB_Name ORDER BY Area_Level";
            using(OracleDataReader odr = OracleHelper.ExecuteReader(sqlStr,CommandType.Text,null)){
                while (odr.Read())
                {
                    DQ_FB_Name _obj = new DQ_FB_Name();
                    _obj.FenBu = odr.GetString(0);
                    _objs.Add(_obj);
                }
            }
            return _objs;
        }

        public static IList<DQ_FB_Name> GetAllBSCByFb(string argFb)
        {
            IList<DQ_FB_Name> _objs = new List<DQ_FB_Name>();
            string sqlStr = "SELECT BSC FROM Ds_Orga_T WHERE Fb = :Fb ORDER BY bsc";
            OracleParameter[] _params = { 
                new OracleParameter(":Fb",OracleType.VarChar,64)
            };
            _params[0].Value = argFb;
            using (OracleDataReader odr = OracleHelper.ExecuteReader(sqlStr, CommandType.Text, _params))
            {
                while (odr.Read())
                {
                    DQ_FB_Name _obj = new DQ_FB_Name();
                    _obj.FenBu = odr.GetString(0);
                    _objs.Add(_obj);
                }
            }
            return _objs;
        }
    }
}
